package com.gx.smart.building.ui.assets.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.recyclerview.widget.RecyclerView;

import com.gx.smart.base.BaseAdapter;
import com.gx.smart.building.R;
import com.gx.smart.building.databinding.ItemRunningStateLayoutBinding;
import com.huishi.gx.ib.grpc.lib.ib.admin.maintenance.device.operatestatus.v1.Status;

/**
 * @author xiaosy
 * @create 2020/5/8
 * @Describe 维修详情
 **/
public class RunningStateAdapter extends BaseAdapter<Status, RunningStateAdapter.ViewHolder> {
    public RunningStateAdapter(Context context) {
        super(context);
    }

    @Override
    protected int onBindLayout() {
        return R.layout.item_running_state_layout;
    }

    @Override
    protected ViewHolder onCreateHolder(View view) {
        ItemRunningStateLayoutBinding binding = ItemRunningStateLayoutBinding.inflate(LayoutInflater.from(mContext),
                (ViewGroup) view, false);
        return new ViewHolder(binding);
    }

    @Override
    protected void onBindData(ViewHolder holder, Status item, int position) {
        holder.binding.label.setText(item.getLabel());
        holder.binding.value.setText(item.getValue());
    }

    protected static class ViewHolder extends RecyclerView.ViewHolder {
        private final ItemRunningStateLayoutBinding binding;

        public ViewHolder(ItemRunningStateLayoutBinding binding) {
            super(binding.getRoot());
            this.binding = binding;
        }
    }

}
